package com.yyh;

public class Test5 {
    public static void main(String[] args) {
        /*Outer.Inner inner = new Outer().new Inner();
        System.out.println(inner.b);
        System.out.println(inner.innerb);*/
        Outer.Inner inner = new Outer.Inner();
        System.out.println(inner.b);
        System.out.println(inner.innerb);
        inner.method();
        inner.innerMethod();
        System.out.println(Outer.Inner.staticb);
        Outer.Inner.staticMethod();
    }
}
/*//普通成员内部类
class Outer {
    private int a = 10;
    private int outa = 20;
    public void method(){
        System.out.println("外部类方法");
    }
    public void outmethod(){
        System.out.println("外部类方法");
    }
    *//*public void show(){
        Inner inner = new Inner();
        System.out.println(inner.b);
        System.out.println(inner.innerb);
        inner.method();
        inner.innerMethod();
    }*//*
    //普通成员内部类
    class Inner {
        public int b = 30;
        public int innerb = 40;
        public void method() {
            System.out.println("普通成员内部类方法");
        }
        public void innerMethod() {
            System.out.println("普通成员内部类方法");
        }
        *//*public void show(){
            Outer outer = new Outer();
            System.out.println(outer.a);
            System.out.println(outer.outa);
            outer.method();
            outer.outmethod();

        }*//*
    }
}*/
//静态成员内部类
class Outer {
    private int a = 10;
    private int outa = 20;
    public void method(){
        System.out.println("外部类方法");
    }
    public void outmethod(){
        System.out.println("外部类方法");
    }
    public void show(){
        Inner inner = new Inner();
        System.out.println(inner.b);
        System.out.println(inner.innerb);
        inner.method();
        inner.innerMethod();
        System.out.println(Inner.staticb);
        inner.staticMethod();
    }
    //静态成员内部类
    static class Inner {
        public int b = 30;
        public int innerb = 40;
        public static int staticb = 50;
        public void method() {
            System.out.println("静态成员内部类方法");
        }
        public void innerMethod() {
            System.out.println("静态成员内部类方法");
        }
        public static void staticMethod(){
            System.out.println("静态成员内部类方法");
        }
        public void show(){
            Outer outer = new Outer();
            System.out.println(outer.a);
            System.out.println(outer.outa);
            outer.method();
            outer.outmethod();
        }
    }
}
